package com.API;

import java.util.Scanner;

public class Test03 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String username = "admin";
        String password = "123456";
        for (int i = 2; i > 0; i--) {
            System.out.println("请输入用户名");
            String loginUser = sc.nextLine();
            System.out.println("请输入密码");
            String loginPass = sc.nextLine();
            if (username.equals(loginUser) && password.equals(loginPass)) {
                System.out.println("登录成功");
                break;
            } else {
                if (i == 0) {
                    System.out.println("账户已被锁定，请联系管理员");
                } else {
                    System.out.println("登陆失败，你还有" + i + "机会");
                }
            }
        }
    }
}
